package com.currency.admin.controller;


import com.currency.admin.pojo.dto.UserAuthDTO;
import com.currency.admin.service.ISysUserService;
import com.currency.common.result.Result;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 * 用户信息表 前端控制器
 * </p>
 *
 * @author Lan
 * @since 2021-12-10
 */
@RestController
@RequestMapping("/api/v1/user")
public class SysUserController {

    @Resource
    private ISysUserService iSysUserService;

    /**
     * 提供用于用户登录认证信息
     */
    @ApiOperation(value = "根据用户名获取用户信息")
    @ApiImplicitParam(name = "username", value = "用户名", required = true, paramType = "path", dataType = "String")
    @GetMapping("/username/{username}")
    public Result<UserAuthDTO> getUserByUsername(@PathVariable String username) {
        return Result.success(iSysUserService.getByUsername(username));
    }

}
